﻿using System;
using System.Configuration;
using Microsoft.Test.CommandLineParsing;

namespace QuakeStats
{
    class Program
    {
        public static DateTime MasterDate;
        public static int TimeDifference;
        public static string ConnectionString;
        static void Main(string[] args)
        {
            CommandLineArguments cArgs = new CommandLineArguments();
            cArgs.ParseArguments(args);

            // If multiple log files are generated in a day (happens if you restart the server during play), you 
            // need to offset the time a log event occurs so they don't overlap.
            TimeDifference = 0;
            string filename = cArgs.FileName;

            if (cArgs.BaseDate.HasValue)
            {
                MasterDate = cArgs.BaseDate.Value;
            }
            else
            {
                int year = DateTime.Now.Year;
                int month = DateTime.Now.Month;
                int day = DateTime.Now.Day;
                MasterDate = new DateTime(year, month, day, 12, 0, 0);
            }

            LogParser parser = new LogParser(filename);
            parser.ProcessLogFile();
        }
    }
}
